package android.slc.fast.vd.list;

import android.slc.adapter.SelectBox;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;

import java.io.Serializable;

public abstract class BaseListPageMultipleSelectVmSub<T extends Serializable> extends BaseListPageVmSub<SelectBox<T>> {
    public boolean selectChange = false;

    public void select(int position, SelectBox<T> selectBox) {
        selectBox.setChecked(!selectBox.isChecked());
        selectChange = true;
    }

    public void selectAll(boolean selectAll) {
        CollectionUtil.forEach(getDataList(), (CollUtil.Consumer<SelectBox<T>>) (value, index) -> value.setChecked(selectAll));
        getLoadMoreDataFormat3().getLoadModelCallback().refresh(getDataList());
        selectChange = true;
    }
}
